<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-3-7
 * Time: 上午10:15
 */

$socksev = stream_socket_server('tcp://0.0.0.0:8000',$errno,$errstr);

for ($i = 0;$i<5;$i++) {
    if (pcntl_fork() == 0) {
        while(true) {
            $conn = stream_socket_accept($socksev);
            if ($conn == false) {
                continue;
            }
            $request = fread($conn,9000);
            $response = 'hello';
            fwrite($conn.$request);
            fclose($conn);
        }
        exit(0);
    }
}